/*
	This file is part of AVRCppLib.

    AVRCppLib is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    AVRCppLib is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with AVRCppLib.  If not, see <http://www.gnu.org/licenses/>.

    Copyright (C) Maxime Lemonnier 2007-2011
 */

#ifndef ChannelModesV3_H_
#define ChannelModesV3_H_

#include "../Utils/Utils.h"
namespace ADCs
{

namespace ChannelModes
{
	/*!
	 * Channel selection and gain modes
	 * - For ADCX \a toVolts() will return \f$ voltage = \frac{voltage_{ADCX} * 1024 }{voltage_{reference}} \f$
	 * - For ADCX_ADCY_xGAIN \a toVolts() will return \f$ voltage = \frac{voltage_{ADCX}^{time_{0}} - voltage_{ADCY}^{time_{1}} * GAIN * 512 }{voltage_{reference}} \f$
	 */
	enum ChannelMode {

		//!< compare to reference voltage modes :

		ADC0 = 0x00,				//!< compare voltage at pin ADC0 with the reference voltage
		ADC1 = 0x01,				//!< idem with pin ADC1
		ADC2 = 0x02,				//!< idem with pin ADC2
		ADC3 = 0x03,				//!< idem with pin ADC3
		ADC4 = 0x04,				//!< idem with pin ADC4
		ADC5 = 0x05,				//!< idem with pin ADC5
		ADC6 = 0x06,				//!< idem with pin ADC6
		ADC7 = 0x07,				//!< idem with pin ADC7


		//!< differential modes :

		ADC0_ADC0_X10 = 0x08,		//!< compare voltage at pin ADC0 with another reading at ADC0 and amplify the result by 10
		ADC1_ADC0_X10 = 0x09,		//!< compare voltage at pin ADC1 with another reading at ADC0 and amplify the result by 10
		ADC0_ADC0_X200 = 0x0A,		//!< compare voltage at pin ADC0 with another reading at ADC0 and amplify the result by 200
		ADC1_ADC0_X200 = 0x0B,		//!< compare voltage at pin ADC1 with another reading at ADC0 and amplify the result by 200
		ADC2_ADC2_X10 = 0x0C,		//!< compare voltage at pin ADC2 with another reading at ADC2 and amplify the result by 10
		ADC3_ADC2_X10 = 0x0D,		//!< compare voltage at pin ADC3 with another reading at ADC2 and amplify the result by 10
		ADC2_ADC2_X200 = 0x0E,		//!< compare voltage at pin ADC2 with another reading at ADC2 and amplify the result by 200
		ADC3_ADC2_X200 = 0x0F		//!< compare voltage at pin ADC3 with another reading at ADC2 and amplify the result by 200

	};

	size_t gain(ChannelMode mode);

}

}
#endif /* ChannelModes_H_ */
